@page "/detail/{poetryId}"
@inject IParcelBoxService _parcelBoxService
@inject IFavoriteStorage _favoriteStorage
@inject IPoetryStorage _poetryStorage

@if (_isLoadingPoetry) {
    <div>
        <Spinner></Spinner>
    </div>
} else {
    <h1 style="color: #0078d4">@_poetry.Name</h1>
    <div class="shim-xl"></div>
    <h3>@_poetry.Dynasty @_poetry.Author</h3>

    <div class="shim-2xl"></div>
    <h3>@(new MarkupString(_poetry.Content.Replace(Environment.NewLine, "<br />")))</h3>

    <div class="shim-2xl"></div>
    @if (_isLoadingFavorite) {
        <div>
            <Spinner></Spinner>
        </div>
    } else {
        <Toggle @bind-Value="_favorite.IsFavorite"
                OnText="已收藏"
                OffText="未收藏"
                OnValueChanged="_ => ValueChanged()">
        </Toggle>
    }
}